/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package nl.maxato.util;

//
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Danny
 */
public class ConfigurationFile {

    static Properties properties = new Properties();

    public ConfigurationFile() {
        try {
            // properties.load(this.getClass().getClassLoader().getResourceAsStream("config/config.properties"));
            properties.load(new FileInputStream("data/config.properties"));
        } catch (IOException ex) {
            Logger.getLogger(ConfigurationFile.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public static String getLanguage() {
        return properties.getProperty("Language");
    }

    public static void setLanguage(String languague) {
        try {
            properties.setProperty("Language", languague);
            properties.store(new FileOutputStream("data/config.properties"), null);
        } catch (Exception ex) {
            Logger.getLogger(ConfigurationFile.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public static String getCountry() {
        return properties.getProperty("Country");
    }

    public static void setCountry(String country) {
        try {
            properties.setProperty("Country", country);
            properties.store(new FileOutputStream("data/config.properties"), null);
        } catch (Exception ex) {
            Logger.getLogger(ConfigurationFile.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
    public static double getVersion() {
        return Double.parseDouble("2.02");//properties.getProperty("Version"));
    }
}
